package cn.admin.service.impl;

import cn.admin.dao.UserMapper;
import cn.admin.entity.User;
import cn.admin.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author: 毛苏宇
 * @Description: You can do it!
 * @Date: Create in 15:40 2019/3/23
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class UserServiceImpl implements UserService {

    @Autowired private UserMapper userMapper;

    @Override
    public List<User> getUsers() {
        return userMapper.findAllUsers();
    }

    @Override
    public int getNumberOfAuthenticatedUsers() {
        return userMapper.findNumberOfAuthenticatedUsers();
    }

    @Override
    public int getRegisterTodayUsersCount() {
        return userMapper.findRegisterTodayUsersCount();
    }

    @Override
    public boolean modifyIsPaymentStatus(int ispayment, int userId) {
        return userMapper.updateIsPaymentStatus(ispayment, userId)==1?true:false;
    }
}
